package com.dubbo2.lib.controller;

import com.dubbo2.api.api.Dubbo2Service;
import com.dubbo2.api.dto.DubboBaseDto;
import com.dubbo2.api.dto.req.Dubbo2ParamDto;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/dubbo2")
public class TestController {

    @Autowired
    Dubbo2Service dubbo2Service;

    @PostMapping("/test")
    public DubboBaseDto test(@RequestBody Dubbo2ParamDto param) {
        //dubbo1服务的queryDubbo2Provide
        DubboBaseDto result = dubbo2Service.queryDubbo2Provide(param);
        return result;
    }

    @PostMapping("/test2")
    public DubboBaseDto test2(@RequestBody Dubbo2ParamDto param) {
        //dubbo1服务的queryDubbo2Provide
        DubboBaseDto result = dubbo2Service.queryDubbo2Consum(param);
        return result;
    }

}
